package flexo.graphic.entity.particle;

import flexo.graphic.entity.ParticleSystem;
import flexo.math.Vector;

public class SphereEmitter extends AbstractEmitter
{
	float radius;
	
	public SphereEmitter(float radius)
	{
		if (radius < 0)
		{
			radius *= -1;
		}
		this.radius = radius;
	}

	@Override
	public Vector getNewPosition(ParticleSystem sys)
	{
		Vector v = Vector.getTempVector();
		v.x = (sys.getRandom() - 0.5f) * radius;
		v.y = (sys.getRandom() - 0.5f) * radius;
		v.z = (sys.getRandom() - 0.5f) * radius;
		return v;
	}
}
